package com.xiangban.xiangbanmall.controller;

import com.xiangban.xiangbanmall.model.TUserTicket;
import com.xiangban.xiangbanmall.model.res.ApiResult;
import com.xiangban.xiangbanmall.service.TicketService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Mr. MaYaYun
 * @Data 2021/12/27 10:11
 */
@RestController
@RequestMapping("/api/mall/ticket")
public class TicketController {

    @Autowired
    private TicketService ticketService;


    @RequestMapping("/convertTicket")
    @ApiOperation("核销兑换券")
    public ApiResult<Object> convertTicket(@RequestBody TUserTicket ticket){
        ticketService.convertTicket(ticket);
        return ApiResult.newSuccess();
    }

    @RequestMapping("/listTicketPage")
    @ApiOperation("卡券列表")
    public ApiResult<Object> listTicketPage(@RequestBody TUserTicket ticket){
        return ApiResult.newSuccess(ticketService.listTicketPage(ticket));
    }
}
